package com.qdu.study_app.Activity;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.cardview.widget.CardView;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;

import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.qdu.study_app.R;
import com.qdu.study_app.bean.StudyItem;
import com.qdu.study_app.fragment.StudyFragment;
import com.qdu.study_app.fragment.StudyViewModel;

import java.util.ArrayList;
import java.util.List;

public class Activity_index extends AppCompatActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_index);
        // 引入底部导航
        BottomNavigationView bottomNavigationView = findViewById(R.id.bottomNavigationView);

        NavController navController = Navigation.findNavController(this,R.id.fragment);
        AppBarConfiguration configuration = new AppBarConfiguration.Builder(navController.getGraph()).build();
      //  NavigationUI.setupActionBarWithNavController(this,navController,configuration);
        NavigationUI.setupWithNavController(bottomNavigationView,navController);


        bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
            @Override
            public boolean onNavigationItemSelected(@NonNull MenuItem item) {
                switch (item.getItemId()){
                    case R.id.study_item:
                        navController.navigate(R.id.studyFragment);
                        return true;
                    case R.id.studyBoard_item:
                        navController.navigate(R.id.studyBoard);
                        return true;
                    case R.id.studySetting_item:
                        navController.navigate(R.id.studySetting);
                        return true;
                }

                return false;
            }
        });
    }
    public void init(){
        // 获取列表
    }

    public void Destroy(){
        onBackPressed();
    }
    @Override
    protected void onDestroy() {
        super.onDestroy();
    }
}